package com.music.controller;

import com.music.pojo.Category;
import com.music.service.CateGoryService;
import com.music.utils.ResultInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/cate")
public class CateGoryConroller {

    @Autowired
    private CateGoryService cateGoryService;

    @RequestMapping("/findAll")
    public ResultInfo findAll(){
        List<Category> categories = cateGoryService.findAll();
        ResultInfo resultInfo = new ResultInfo(true);
        resultInfo.setData(categories);
        return resultInfo;
    }

    @RequestMapping("lan")
    @ResponseBody
    public List<Category> findLanguage(){
        return cateGoryService.findLanguage();
    }
    @RequestMapping("sty")
    @ResponseBody
    public List<Category> findStyle(){
        return cateGoryService.findStyle();
    }
}
